#include "StdAfx.h"
#include "CutEntity.h"

CutEntity_cl::CutEntity_cl(void)
{
}

CutEntity_cl::~CutEntity_cl(void)
{
}

void CutEntity_cl::Release()
{
	m_pCutREntity->DisposeObject();
	m_pCutLEntity->DisposeObject();
}

void CutEntity_cl::CreateEntity( const char* LeftModelFile, const char* RightModelFile )
{
	m_pCutREntity = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3 (0,0,0), RightModelFile);
	m_pCutLEntity = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3 (0,0,0), LeftModelFile);
	m_pCutLEntity->SetUseEulerAngles(TRUE);
	m_pCutREntity->SetUseEulerAngles(TRUE);
	m_pCutLEntity->SetOrientation(hkvVec3 (-90.f,0,0));
	m_pCutREntity->SetOrientation(hkvVec3 (-90.f,0,0));

	m_ResetCutRMatrix.Identity();
	m_ResetCutLMatrix.Identity();
	m_pCutREntity->GetRotationMatrix(m_ResetCutRMatrix);
	m_pCutLEntity->GetRotationMatrix(m_ResetCutLMatrix);

	m_iCutRVisibleBitMask = m_pCutREntity->GetVisibleBitmask();
	m_iCutLVisibleBitMask = m_pCutLEntity->GetVisibleBitmask();
}

void CutEntity_cl::Reset( const char* LeftModelFile, const char* RightModelFile )
{
	m_pCutREntity->SetRotationMatrix(m_ResetCutRMatrix);
	m_pCutLEntity->SetRotationMatrix(m_ResetCutLMatrix);

	m_pCutREntity->SetMesh(RightModelFile);
	m_pCutLEntity->SetMesh(LeftModelFile);
}


void CutEntity_cl::SetVisible(bool visible)
{
	m_pCutREntity->SetVisibleBitmask(visible ? m_iCutRVisibleBitMask:0);
	m_pCutLEntity->SetVisibleBitmask(visible ? m_iCutLVisibleBitMask:0);
}

void CutEntity_cl::SetPosition( const hkvVec3& vPos )
{
	m_pCutREntity->SetPosition(vPos);
	m_pCutLEntity->SetPosition(vPos);
}

void CutEntity_cl::SetOrientation( const hkvVec3& vYPR )
{
	m_pCutLEntity->SetOrientation(vYPR);
	m_pCutREntity->SetOrientation(vYPR);
}

void CutEntity_cl::IncOrientation( const hkvVec3& vYPR )
{
	m_pCutLEntity->IncOrientation(vYPR);
	m_pCutREntity->IncOrientation(vYPR);
}

void CutEntity_cl::SetScaling( const hkvVec3& vScale )
{
	m_pCutLEntity->SetScaling(vScale);
	m_pCutREntity->SetScaling(vScale);
}